package Test;

import Util.JavaUtil;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;

public class library {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        Scanner scanner=new Scanner(System.in);

        String sql="select * from books";
        ResultSet rs= JavaUtil.executeQuery(sql);
        while(rs.next()){
            System.out.println("书的序号为"+rs.getObject("bookId")+"剩余的数量为"+rs.getObject("bookcounts"));
        }

        String sql1="update books set bookid=6 where bookname='jdbc'";
        int num=JavaUtil.executeUpdate(sql1);
        if(num>0){
            System.out.println("修改成功");
        }else{
            System.out.println("修改失败");
        }
        JavaUtil.close();
    }

}
